/**
 * 
 */
package todolist.helpers;

import java.util.ArrayList;

import todolist.structures.Task;


/**
 * @author Andrew
 *
 */
public abstract class Filter {

	public Task[] filterStatus(Task[] startingList, boolean complete){
		
		ArrayList<Task> finalList = new ArrayList<Task>();
		
		for (int i=0; i < startingList.length; i++){
			//if(startingList[i].isComplete() == complete)
				finalList.add(startingList[i]);
		}
		
		return (Task[]) finalList.toArray();
	}
	
	public Task[] filterType(Task[] startingList, String type){
		
		ArrayList<Task> finalList = new ArrayList<Task>();
		
		for (int i=0; i < startingList.length; i++){
			if(startingList[i].getTaskType().toLowerCase().equals(type.toLowerCase()))
				finalList.add(startingList[i]);
		}
		
		return (Task[]) finalList.toArray();
	}
}
